import { axios } from '@/utils/request'

/**
 * api接口列表
 */
const api = {
  index: '/book/zip',
  fileList: '/book/file',
  uploadZip:'/book/upload/zip',
  uploadFile:'/book/upload/file',
  dirList:'/book/dirList',
  add:'/book/add',
  scan:'/book/scan',
  groupList: '/book/groupList',
  deleteFile:'/book/file/del',
  addGroup:'/book/group/add',
  delGroup:'/book/group/del',
  editGroup:'/book/group/edit',
}

/**
 * 列表记录
 */
export function list (params) {
  return axios({
    url: api.index,
    method: 'get',
    params
  })
}


export function fileList(params){
  return axios({
    url: api.fileList,
    method: 'get',
    params
  })
}

/**
 * 列表记录
 */
export function groupList (params) {
  return axios({
    url: api.groupList,
    method: 'get',
    params
  })
}


/**
 * 上传zip
 * @param {*} data
 */
export function uploadZip (data) {
  return axios({
    url: api.uploadZip,
    method: 'post',
    data
  })
}

/**
 * 上传file
 * @param {*} data
 */
export function uploadFile (data) {
  return axios({
    url: api.uploadFile,
    method: 'post',
    data
  })
}
export function add(params){
  return axios({
    url:api.add,
    method:'get',
    params
  })
}
export function dirList(){
  return axios({
    url:api.dirList,
    method:'get'
  })
}

export function scan(params){
  return axios({
    url:api.scan,
    method:'get',
    params
  })
}

export function deleted(data){
  return axios({
    url: api.deleteFile,
    method: 'post',
    data
  })
}

export function addGroup(data){
  return axios({
    url: api.addGroup,
    method: 'post',
    data
  })
}

export function delGroup(params){
  return axios({
    url: api.delGroup,
    method: 'get',
    params
  })
}
export function editGroup(data){
  return axios({
    url: api.editGroup,
    method: 'post',
    data
  })
}